| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Static Public Member Functions | List of all members
nkImages::BmpEncoder Class Referencefinal

Offers capabilities to encode and decode BMP format. More...

## Static Public Member Functions
static nkMemory::Buffer | encode (const ImageView &image)
static bool | canDecode (nkMemory::BufferView< unsigned char > data)
static Image | decode (nkMemory::BufferView< unsigned char > data, const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor())

## Detailed Description

Offers capabilities to encode and decode BMP format.

## Member Function Documentation

## ◆ encode()

static nkMemory::Buffer nkImages::BmpEncoder::encode | ( | const ImageView & | image | ) |
| static

Encodes an image into a binary buffer fitting the BMP format.

Parameters

  image | The image to encode.

Returns
  The binary buffer holding the encoded image.

Remarks
  If the format range goes outside of what BMP can encode (for instance, R32G32B32), the values will get clamped to a working range of values.

## ◆ canDecode()

static bool nkImages::BmpEncoder::canDecode | ( | nkMemory::BufferView< unsigned char > | data | ) |
| static

Checks whether a binary buffer can be decoded by this encoder. This checks the file header for the magic bytes.

Parameters

  data | The binary data which need to be checked.

Returns
  Whether the binary buffer can be decoded (true) or not (false).

Remarks
  Currently, this function searches for the 'B' and 'M' header chars. Any other char combination will be ignored ('O' and 'S'...).

## ◆ decode()

static Image nkImages::BmpEncoder::decode | ( | nkMemory::BufferView< unsigned char > | data,
|  | const AlignmentDescriptor & | alignmentDescriptor = `AlignmentDescriptor()`
| ) |  |
| static

Decodes a binary buffer into its image representation.

Currently supported compressions are :

- BI_RGB : standard non compressed data
- BI_[ALPHA]BITFIELDS : data compressed through the use of bit fields

Unsupported compressions are :

- PNG
- JPG
- RLE variants

Parameters

  data | The binary buffer to decode.
  alignmentDescriptor | If decoded image's data needs to fit some alignment requirements, they can be specified through this parameter.

Returns
  The decoded image, if data could be decoded.

Remarks
  If something goes wrong, the error will be logged and an empty image will be returned.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsImages/Bmp/BmpEncoder.h